/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package au.edu.swin.swinvehicle.vehicletype;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Administrator
 */
@Entity
@NamedQueries({
    @NamedQuery(name = "findAllVehicleTypes",
    query = "SELECT vt FROM VehicleTypeEntity vt")
})
@Table(name = "VEHICLETYPE")
public class VehicleTypeEntity implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    @Column(length = 15, unique = true, nullable = false)
    private String code;
    @Column(length = 63, nullable = false)
    private String description;
    @Column(nullable = false)
    private Integer seats;

    public VehicleTypeEntity() {
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getSeats() {
        return seats;
    }

    public void setSeats(Integer seats) {
        this.seats = seats;
    }

    // Transfer Object Methods
    public VehicleTypeTO getData() {
        return new VehicleTypeTO(id, code);
    }

    @Override
    public String toString() {
        return "au.edu.swin.swinvehicle.vehicletype.VehicleTypeEntity[id=" + id + "]";
    }
}
